import { ApiProperty } from "@nestjs/swagger"
import { IsNotEmpty, IsOptional } from "class-validator"

export class CreateUserDto {
  @ApiProperty({ description: '用户名', default: '' })
  @IsNotEmpty({ message: '用户名必填' })
  readonly account: string

  @ApiProperty({ description: '密码', default: '' })
  @IsNotEmpty({ message: '密码必填' })
  readonly password: string

  @ApiProperty({ description: '邮箱', default: '' })
  @IsNotEmpty({ message: '邮箱必填' })
  readonly email: string

  @ApiProperty({ description: '验证码', default: '' })
  @IsNotEmpty({ message: '验证码必填' })
  readonly code: string

  // @ApiProperty({ description: '昵称', default: '' })
  // @IsNotEmpty({ message: '昵称必填' })
  // readonly nickname: string

  @ApiProperty({ description: '角色', required: false, default: '' })
  @IsOptional()
  readonly role?: number
}

export class PhoneCreateUserDto {
  @ApiProperty({ description: '手机号', default: '' })
  @IsNotEmpty({ message: '手机号必填' })
  readonly phone: string

  @ApiProperty({ description: '验证码', default: '' })
  @IsNotEmpty({ message: '验证码必填' })
  readonly code: string

  @ApiProperty({ description: '密码', default: '' })
  @IsNotEmpty({ message: '密码必填' })
  readonly password: string

  // @ApiProperty({ description: '昵称', default: '' })
  // @IsNotEmpty({ message: '昵称必填' })
  // readonly nickname: string

  @ApiProperty({ description: '角色', required: false, default: '' })
  @IsOptional()
  readonly role?: number
}